<template>
  <div class="food">
    <sea-header/>
    <sea-logo/>
    <sea-recommend :list="seaRecommendList "/>
    <sea-footer/>
  </div>
</template>

<script>
import SeaHeader from "./components/SeaHeader.vue";
import SeaLogo from "./components/SeaLogo.vue";
import SeaRecommend from "./components/SeaRecommend.vue";
import SeaFooter from "./components/SeaFooter.vue";
import axios from "axios";
export default {
  name: "foodBarbecue",
  components: {
    SeaHeader,
    SeaLogo,
    SeaRecommend,
    SeaFooter
  },
  data: function() {
    return {
      seaRecommendList: []
    };
  },
  mounted() {
    this.getHomeApiInfo();
  },
  methods: {
    getHomeApiInfo() {
      axios
        .get("/mock/Food/seaFood.json")
        .then(this.getHomeResponseInfo, function(success) {
          console.log("请求json数据成功");
          console.log(success);
        })
        .catch(function(err) {
          console.log("请求json数据失败");
          console.log(err);
        });
    },
    getHomeResponseInfo(response) {
      console.log(response.data);
      let res = response.data;
      if (res.success && res.dataList) {
        const seaData = res.dataList;
        this.seaRecommendList = seaData.SeaRecommedLists;
      }
    }
  }
};
</script>          